import 'package:flutter/material.dart';

class MyScrollWidget extends StatelessWidget {
  final Widget bottomButton;
  final double overScroll;
  final List<Widget> children;

  const MyScrollWidget(this.children,
      {Key key, this.bottomButton, this.overScroll = 16.0});

  @override
  Widget build(BuildContext context) {
    if (Theme.of(context).platform == TargetPlatform.iOS) {
      // iOS 键盘处理 - https://github.com/diegoveloper/flutter_keyboard_actions
    }

    List<Widget> htlWidgets = [
      Expanded(
        // flex: 1,
        child: SingleChildScrollView(
          padding: EdgeInsets.symmetric(horizontal: 16.0),
          physics: BouncingScrollPhysics(),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: children,
          ),
        ),
      ),
      // Expanded(
      //   child: Container(
      //     color: Colors.redAccent,
      //   ),
      // ),
      // Container(
      //   height: 560.0,
      //   child: Container(
      //     color: Colors.redAccent,
      //     constraints: BoxConstraints.expand(),
      //   ),
      // ),
    ];

    if (bottomButton != null) {
      htlWidgets.add(Container(
        child: this.bottomButton,
      ));
    }

    return SafeArea(
      child: Column(
        children: htlWidgets,
      ),
    );
  }
}
